package com.zhl.microservcie.servcie;

import com.zhl.microservcie.pojo.Item;
import org.springframework.stereotype.Service;

import java.util.HashMap;
import java.util.Map;

/**
 * @program: microservcie-parent
 * @author: zhl
 * @create: 2019-03-04
 **/
@Service
public class ItemServcie {

    private static final Map<Long, Item> MAP = new HashMap<>();

    static {
        MAP.put(1l, new Item(1l, "商品标题1", "http://图片1", "商品描述1", 1000l));
        MAP.put(2l, new Item(2l, "商品标题2", "http://图片2", "商品描述2", 2000l));
        MAP.put(3l, new Item(3l, "商品标题3", "http://图片3", "商品描述3", 3000l));
        MAP.put(4l, new Item(4l, "商品标题4", "http://图片4", "商品描述4", 4000l));
        MAP.put(5l, new Item(5l, "商品标题5", "http://图片5", "商品描述5", 5000l));
        MAP.put(6l, new Item(6l, "商品标题6", "http://图片6", "商品描述6", 6000l));
    }

    public Item queryItemById(Long id){
        return MAP.get(id);

    }
}
